package com.yiren.dbaa.module.practice_set.site.presenter;

import android.app.Activity;

import com.yiren.backstage.config.api.LoadConfigApi;
import com.yiren.backstage.config.bean.device.UserParamConfigBean;
import com.yiren.dbaa.currency.api.CommonCallBack;
import com.yiren.dbaa.module.practice_set.site.contract.OpenSiteRuleContract;
import com.yiren.dbaa.module.practice_set.site.contract.SiteRuleContract;
import com.yiren.dbaa.module.practice_set.site.model.OpenSiteRuleModel;
import com.yiren.dbaa.module.practice_set.site.model.SiteRuleModel;

/**
 * @author lwb
 * @date : 2022/10/17 8:49
 * @description: 已公开考规P
 */
public class OpenSiteRulePresenter implements OpenSiteRuleContract.Presenter {


    private Activity activity;
    private OpenSiteRuleContract.Model openSiteRuleModel;
    private SiteRuleContract.Model siteRuleModel;
    public OpenSiteRulePresenter(Activity activity) {
        this.activity = activity;
        openSiteRuleModel = new OpenSiteRuleModel(activity);
        siteRuleModel = new SiteRuleModel(activity);
    }


    @Override
    public void loadOpenSiteRule(CommonCallBack callBack) {
        //从服务器获取规则
        UserParamConfigBean userParamConfigBean = LoadConfigApi.loadUserParamConfig(activity);
        siteRuleModel.getSiteRuleFromServer(userParamConfigBean.getUserInfo().getId().toString(),true,callBack);
    }

    @Override
    public void setSiteRuleState(int state,String userId,double rulver,String siteCode, CommonCallBack callBack) {
        openSiteRuleModel.changeSiteRuleState(state, userId,rulver,siteCode,callBack);

    }

}
